/**
 * 
 */
package org.trajectory.web.rest.resources;

import java.util.List;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.trajectory.dao.ShopDao;
import org.trajectory.data.Shop;

/**
 * @author Administrator
 *
 */
@Component
@Path("/trajectory/{datasource}/shop/query")
public class QueryShop {
	private ShopDao shopService;
	
	@Autowired
	public void setShopService(ShopDao shopService) {
		this.shopService = shopService;
	}

	@GET
	@Produces({"application/json"})
	public List<Shop> getResources(@PathParam("datasource") String datasource) throws Exception{
		return shopService.loadShops(datasource);
	}
	
	@GET
	@Produces({"application/json"})
	@Path("/{shop}")
	public Shop getShop(@PathParam("datasource") String datasource , @PathParam("shop") Integer shopId) throws Exception{
		
		return shopService.loadShop(datasource,shopId);
	}
}
